# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-unearth
pkgver=0.12.1
pkgrel=0
pkgdesc="Utility to fetch and download python packages"
url="https://github.com/frostming/unearth"
arch="noarch"
license="MIT"
depends="py3-packaging py3-requests"
makedepends="py3-pdm-backend py3-gpep517 py3-installer py3-trustme"
checkdepends="py3-pytest py3-flask py3-requests-wsgi-adapter py3-pytest-httpserver"
subpackages="$pkgname-pyc"
source="https://github.com/frostming/unearth/archive/$pkgver/py3-unearth-$pkgver.tar.gz"
builddir="$srcdir/unearth-$pkgver"

build() {
	export PDM_BUILD_SCM_VERSION=$pkgver
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
0a5b396ac162f4e462048f978ad66f35190f63b580aa8752b191956dbbec3d392223bf15ef57bdb6b7027043cf14982db2c63cec13967126e132c53b03de5501  py3-unearth-0.12.1.tar.gz
"
